// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'

import axios from 'axios'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import { createPinia } from 'pinia'
const pinia = createPinia()
const app = createApp(App)

// 配置 axios
app.config.globalProperties.$axios = axios
axios.defaults.baseURL = 'http://localhost:8088'

// 配置 Element Plus
app.use(ElementPlus, {
  locale: zhCn,
})

app.use(pinia)
// 配置路由
app.use(router)

// 挂载应用
app.mount('#app')

// 添加错误处理
app.config.errorHandler = (err, vm, info) => {
  console.error('Vue 错误:', err)
  console.error('错误信息:', info)
}
